package com.fitzone.web.controller.mini;

import com.fitzone.common.result.Result;
import com.fitzone.model.entity.Vip;
import com.fitzone.web.service.VipService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/mini/vip")
@RequiredArgsConstructor
@Api(tags = "小程序-会员")
public class MiniVipController {
    private final VipService vipService;

    @GetMapping("/list")
    @ApiOperation("会员类别")
    public Result<List<Vip>> vipList(){
        List<Vip> vipList = vipService.getVipList();
        return Result.ok(vipList);
    }

    @GetMapping("/{id}")
    @ApiOperation("查询vip")
    public Result getVip(@PathVariable Long id){
        return Result.ok(vipService.getById(id));
    }
}
